package cn.xhy.material.dal.mysql.producttype;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.xhy.material.controller.admin.producttype.vo.ProductTypePageReqVO;
import cn.xhy.material.dal.dataobject.producttype.ProductTypeDO;
import org.apache.ibatis.annotations.Mapper;
/**
 * 产品类型 Mapper
 *
 * @author xhy
 */
@Mapper
public interface ProductTypeMapper extends BaseMapperX<ProductTypeDO> {

    default PageResult<ProductTypeDO> selectPage(ProductTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductTypeDO>()
                .likeIfPresent(ProductTypeDO::getName, reqVO.getName())
                .eqIfPresent(ProductTypeDO::getCategoryLevel, reqVO.getCategoryLevel())
                .eqIfPresent(ProductTypeDO::getParentId, reqVO.getParentId())
                .eqIfPresent(ProductTypeDO::getSort, reqVO.getSort())
                .eqIfPresent(ProductTypeDO::getSerialNo, reqVO.getSerialNo())
                .eqIfPresent(ProductTypeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ProductTypeDO::getType, reqVO.getType())
                .betweenIfPresent(ProductTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductTypeDO::getId));
    }

}
